import request from '@/utils/request'
// ---------------------------------------人效统计-------------------------
// 获取运营 / 运维人员 工单统计
export const getTaskReport = (start, end) => request.get(`/api/task-service/task/taskReportInfo/${start}/${end}`)

// 工单统计状态
export const getCollectReport = (start, end) => request.get(`/api/task-service/task/collectReport/${start}/${end}`)

// 获取区域列表
export const getRegionList = () => request.get('/api/vm-service/region/search', {
  params: {
    pageIndex: 1,
    pageSize: 10000
  }
})

// 人员排名 如果是params或data的话，传对象好写，当然得页面对象格式好写
export const getUserWorkerTop = (start, end, isRepair, regionId) =>
  request.get(`/api/task-service/task/userWorkTop10/${start}/${end}/${isRepair}/${regionId}`)

// ----------------------------------------人员列表-------------------------
// 图片上传  绝对要再整理
export const fileUpload = file => request({
  method: 'POST',
  url: '/api/vm-service/sku/fileUpload',
  ContentType: 'multipart/form-data',
  data: { fileName: file }
})

// 获取人员列表
export const getUserWorkerList = params => {
  return request({
    url: '/api/user-service/user/search',
    params
  })
}

// 删除人员 /api/user-service/user/:id
export const delUserWork = id => request.delete(`/api/user-service/user/${id}`)

// 新增人员
export const addUserWork = data => request.post('/api/user-service/user', data)

// 修改人员
export const updateUserWork = (id, data) => request({
  method: 'PUT',
  url: `/api/user-service/user/${id}`,
  data: data
})
// ---------------------------------------工作量------------------------------
// 获取工作量列表 /api/user-service/user/searchUserWork
export const getUserWorkList = params => request.get('/api/user-service/user/searchUserWork', { params })

// 获得角色列表查询 /api/user-service/role
export const getRoleList = () => request.get('/api/user-service/role')

// 获取个人工作量列表，按时间
export const getUserWork = (userId, start, end) => request.get('/api/task-service/task/userWork', {
  params: { userId, start, end }
})

// 获取个人用户基本信息
export const getUserInfo = id => request.get(`/api/user-service/user/${id}`)
